#include "register.h"
#include "ui_register.h"

Register::Register(QUdpSocket* udp)
    :ui(new Ui::Register)
{
    ui->setupUi(this);
    setWindowTitle("注册");
    this->udp=udp;
}

Register::~Register()
{
    udp=nullptr;
    delete ui;

}

void Register::on_pushButton_login_3_clicked()
{
    QString news="T,"+ui->lineEdit_5->text()+",";
    if(ui->comboBox->currentText()=="商家")
        news+="merchant";
    else
        news+="courier";
    news+=","+ui->lineEdit_6->text()+","+ui->lineEdit_7->text();
    QNetworkDatagram nw(news.toUtf8(),QHostAddress("127.0.0.1"),12345);
    udp->writeDatagram(nw);
}

void Register::on_pushButton_login_4_clicked()
{
    this->close();
}
